
def next_bigger_element(nums1:list, nums2:list) -> list:
    res = []
    for i in range(len(nums1)):
        if nums2.index(nums1[i]) + 1 < len(nums2) and nums2[nums2.index(nums1[i]) + 1] > nums1[i]:
            res.append(nums2[nums2.index(nums1[i]) + 1])
        else:
            res.append(-1)
    return res


nums1_1 = [4,1,2]
nums2_1 = [1,3,4,2]

nums1_2 = [2,4]
nums2_2 = [1,2,3,4]

print(next_bigger_element(nums1_1, nums2_1))
print(next_bigger_element(nums1_2, nums2_2))